// 你是一段成熟的代码，要学会自己改bug
'use strict'

// import modals from '../modals'

/**
 * 用户信息
 */
const user = {
  state: {
    user: {
      account: '',
      name: '',
      userId: 0
    }
  },
  getters: {
    user: state => state.user
  },
  mutations: {
    /**
     * 保存用户信息
     * @param state
     * @param userInfo
     */
    saveLoginInfo (state, userInfo) {
      state.user.userId = userInfo.userId
      state.user.name = userInfo.name
      state.user.account = userInfo.account
    }
  },
  actions: {
    saveLoginInfo ({commit}, userInfo) {
      commit('saveLoginInfo', userInfo)
    }
  }
}

export default user
